<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:x="http://java.sun.com/jstl/xml">

<h:head>
	<title>Globallogic vacation planner 1.0</title>
	<link rel="stylesheet" type="text/css" href="css/container.css" />
	<link rel="stylesheet" type="text/css" href="css/createProject.css" />
	<link rel="stylesheet" type="text/css" href="css/userPage.css" />
</h:head>
<h:body bgcolor="silver">
	<div class="container">

		<center>
			<h2>Create project page</h2>
		</center>

		<div class="poster">
			<a> <img src="images/defaultUser.png" width="160px"
				height="160px" />
			</a>
			<p>
				<a href="editProfile.xhtml">edit profile</a>
			</p>
		</div>
		<div class="about">
			<font color="blue">
				<p>Name: #{userBean.userName}</p>
				<p>Surname: #{userBean.surname}</p>
				<p>Email: #{userBean.email}</p>
			</font>

		</div>
		<div class="links">

			<p align="left">
				<h:form>
					<a href="userPage.xhtml">Home___|___</a>
					<a href="vacation.xhtml">Vacations___|___</a>
					<a href="projects.xhtml">Projects___|___</a>
					<h:commandLink value="Log out" action="#{userBean.logout}" />
				</h:form>
			</p>
		</div>
		<center>
			<div class="table">
				<c:if test="#{projectBean.showCreationForm == null}">
					<h:form>
						<rich:panel header="Creation form">
							<h:panelGrid columns="4">
								<h:outputText value="Project Name" />
								<h:inputText required="true" value="#{projectBean.name}"
									id="name" label="Project Name"
									requiredMessage="Project Name must be not empty"
									validatorMessage="Project name must be for 3 to 15 characters length">
									<f:validateLength minimum="3" maximum="15" />
									<f:validateRequired />
									<rich:validator />
								</h:inputText>
								<rich:message for="name" ajaxRendered="true" />
								<br />
								<h:outputText value="Project description" />
								<h:inputTextarea rows="5" required="true"
									value="#{projectBean.description}" id="description"
									label="Project description"
									requiredMessage="Project Name must be not empty"
									validatorMessage="Project name must be for 3 to 45 characters length">
									<f:validateLength minimum="3" maximum="15" />
									<f:validateRequired />
									<rich:validator />
								</h:inputTextarea>
								<rich:message for="description" ajaxRendered="true" />
							</h:panelGrid>
							<rich:panel style="width:560px;">
								<f:facet name="header">
									<h:outputText value="Users list"></h:outputText>
								</f:facet>
								<rich:pickList value="#{projectBean.selectedUsers}"
									sourceCaption="Users list" targetCaption="Selected users"
									listWidth="165px" listHeight="100px" orderable="true">
									<f:selectItems value="#{projectBean.users}" var="user"
										itemValue="#{user}" itemLabel="#{user.login}" />
									<f:converter converterId="userListConverter" />
								</rich:pickList>
							</rich:panel>
							<h:panelGrid columns="2">
								<a4j:commandButton action="#{projectBean.createProject}"
									value="Create project" style="height: 20px; width: 100px" />
							</h:panelGrid>
						</rich:panel>
					</h:form>
					
				</c:if>
				<h:form>
				<c:if test="#{not empty projectBean.resultCreation}">
					<h3>
						<font color="red">#{projectBean.resultCreation}</font>
					</h3>
					<h:panelGrid columns="2">
						<a4j:commandButton action="#{projectBean.createNewProject}"
							value="Create new project" style="height: 20px; width: 150px" />
					</h:panelGrid>
				</c:if>
				</h:form>
			</div>
		</center>
	</div>

</h:body>
</html>
